//1、导入 request请求工具
import axios from "@/utils/request";
// 2、导入路径 path
import path from "./path";


//定义一个api对象
const api = {
    //查询所有摄影师信息
    getPhotoAll() {
        return axios.get(path.baseUrl + path.getPhotoAll)
    },
    getPhotoByPage(page) {
        return axios.get(path.baseUrl + path.getByPagePhoto, { params: page })
    },
    //删除阿里云图片接口
    deleteAliyunPhoto(oldPic) {
        //解析参数，拼接
        const param = new URLSearchParams;
        //key值需要与后台形参一致
        param.append("oldUrl", oldPic)
        return axios.patch(path.baseUrl + path.deleteAliyunPhoto, param)
    },
    //注册摄影师
    addPhoto(photo) {
        return axios.post(path.baseUrl + path.addPhoto, photo)
    },
    //修改摄影师信息
    updatePhoto(photo) {
        return axios.put(path.baseUrl + path.updatePhoto, photo)
    },
    //删除摄影师信息
    deletePhoto(id) {
        //解析参数，拼接
        const param = new URLSearchParams;
        //key值需要与后台形参一致
        param.append("id", id)
        return axios.patch(path.baseUrl + path.deletePhoto, param)
    },

}

//导出api
export default api;